home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- #
- # check for users with lots of disk space used
- #
- MINUSERID=500 # where your uids start
- # (lowest "regular user")
- MAXSIZE=8192 # max number of 512 byte blocks for trigger
- # (1024 * (Megabytes) = MAXSIZE)
- #
- # uncomment only one of the following two lines:
- PASSWD="cat /etc/passwd" # if not using NIS
- # PASSWD="ypcat passwd" # if using NIS
-
- HOST=`hostname`
- TMP=/tmp/duck.$$
- rm -f $TMP
-
- DFCOMMAND=/bin/df
-
- touch $TMP
- for i in `$PASSWD | awk -F: '{if ($3 > '$MINUSERID') print $6}'`
- do
- cd $i
- x=`$DFCOMMAND . | grep "^/"`
- if [ "$x" != "" ]; then # if local to this host
- size=`du -s . | awk '{print $1}'`
- if [ $size -gt $MAXSIZE ]; then
- echo "$i ($size)" >>$TMP
- fi
- fi
- done
-
- n=`wc -l $TMP | awk '{print $1}'`
- if [ $n -gt 0 ]; then
- echo " "
- echo "User directories on $HOST larger than $MAXSIZE 512-byte blocks:"
- echo " "
- sed 's/^/ /' $TMP
- echo " "
- fi
- /bin/cp $TMP /tmp/user.chk
- rm -f $TMP
-
-